<?php
namespace app\index\controller;

use app\common\controller\Base;
use think\Request;

/**
 * 菜单树
 */
class Menu extends Base
{

    protected $model;

    /**
     * 控制器初始化
     * @return   void
     */
    public function _initialize()
    {

        parent::_initialize();
        $this->model = new \app\index\model\Menu();
    }
    /**
     * 菜单列表
     */
    public function doList(Request $request)
    {

        $map = ['status' => 1];
        $res = $this->model->doList($map);
        return json($res);
    }
    /**
     * 导航菜单列表
     */
    public function doMenuList($role_id = null)
    {

        $res = $this->model->doMenuList($role_id);
        return json($res);
    }
    /**
     * 菜单列表
     */
    public function getParentId($menu_id)
    {

        $model = $this->model;

        $record = $model::get($menu_id);
        $item = $record->getData();
        return ($item['pid']);
    }
}
